﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Configuration;

namespace Billing
{
    public class Global : HttpApplication
    {
        protected void Application_Start(object sender, EventArgs e)
        {
            ClsApplicationConfiguration.setConfigure();
            DBLibrary.DBFactory.InitConnectString(ConfigurationManager.ConnectionStrings["ConnectionString"].ToString());
        }

        protected void Session_Start(object sender, EventArgs e)
        {
        }

        protected void Application_BeginRequest(object sender, EventArgs e)
        {
        }

        protected void Application_AuthenticateRequest(object sender, EventArgs e)
        {
        }

        protected void Application_Error(object sender, EventArgs e)
        {
            log4net.Logger.Error("Application_Error, Type=" + Server.GetLastError().GetType().ToString() + ", Message=" + Server.GetLastError().Message + ", Trace:" + Server.GetLastError().StackTrace);
            Response.Redirect("default.aspx",true);
        }

        protected void Session_End(object sender, EventArgs e)
        {
            this.Session.Clear();
            //this.Response.Redirect("default.aspx");
        }

        protected void Application_End(object sender, EventArgs e)
        {
        }
    }
}